﻿//表单通用 javascript 脚本设计

///获取单选ＩＤ
function getSelectRowId() {
    return $("input[type=radio][name=rowGuid][@checked]").val();
}
///获取多选ＩＤ
function getSelectRowsId() {
    var id = "";
    $("input[type=checkbox][name=rowGuid][@checked]").each(function(i, o) {
        id = id + o.value + ",";
    });
    return id;
}
//是否已选择ＩＤ
function hasId(msg) {
    var id = getSelectRowId();
    if (id == "" || id == undefined || id == null)
    { alert(msg); return false; }
    return true;
}

function showResult(result,msg) {
    if (result == "") {
        alert(msg);
    }
}

//发送ajax请求
function ajaxGet(url, agrs) {
    $.get(url, args, function(result) { return result; });
}

//切换tab页面
function changeTab(id) {
    $("div[id^=tab]").hide();
    $("div[id=tab" + id + "]").show();
}

//表单检测
function validForm() {
    $("input[valid=T]").each(function(i, o) {
        if ($(this).val() == "") { alert(o.msg); return false; }
    });
    $("select[valid=T]").each(function(i, o) {
        if ($(this).val() == "") { alert(o.msg); return false; }
    });
    return true;
}
